/*
 *簡化的用戶對象 
 */
package main;

import java.sql.ResultSet;

import twitter4j.User;

public class UserLite {

	private int id;

	private String screenName;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getScreenName() {
		return screenName;
	}

	public void setScreenName(String screenName) {
		this.screenName = screenName;
	}

	public UserLite() {

	}

	public UserLite(User u) {
		super();
		setId(u.getId());
		setScreenName(u.getScreenName());
	}

	public UserLite(ResultSet rs) {
		super();
		try {
			setId(rs.getInt("ID"));
			setScreenName(rs.getString("SCREEN_NAME"));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public boolean equals(Object obj) {
		boolean returnValue = false;
		if (obj instanceof UserLite) {
			UserLite ul = (UserLite) obj;
			if (getId() == ul.getId() && getScreenName() != null
					&& ul.getScreenName() != null
					&& getScreenName().equals(ul.getScreenName())) {
				returnValue = true;
			}
		}
		return returnValue;
	}

}
